package com.jinlia.show.modules.system.controller;

import com.jinlia.show.modules.base.system.entity.OrderLog;
import com.jinlia.show.modules.base.system.service.OrderLogMapperService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequiredArgsConstructor
@RequestMapping("/order/log")
public class OrderLogController {

    @Autowired
    OrderLogMapperService orderLogMapperService;

    /**
     * 销售订单日志
     * @param id
     * @return
     */
    @GetMapping("/sale/order/{id}")
    public ResponseEntity<List<OrderLog>> saleOrder(@PathVariable("id") Long id) {
        return ResponseEntity.ok(orderLogMapperService.saleOrder(id));
    }

    /**
     * 配送单日志
     * @param id
     * @return
     */
    @GetMapping("/delivery/order/{id}")
    public ResponseEntity<List<OrderLog>> deliveryOrder(@PathVariable("id") Long id) {
        return ResponseEntity.ok(orderLogMapperService.deliveryOrder(id));
    }

    /**
     * 跑腿单日志
     * @param id
     * @return
     */
    @GetMapping("/errand/order/{id}")
    public ResponseEntity<List<OrderLog>> errandOrder(@PathVariable("id") Long id) {
        return ResponseEntity.ok(orderLogMapperService.errandOrder(id));
    }
}
